home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
WarriorsProgress.sit
/
Warrior’s Progress
/
source code
/
Source
/
Libraries
/
Commands
/
Commander.h
< prev
next >
Wrap
Text File
|
1997-06-28
|
940b
|
43 lines
// Commander.h
#ifndef Commander_h
#define Commander_h
#ifndef Assert_h
#include "Assert.h"
#endif
#ifndef ContextMaintainer_h
#include "ContextMaintainer.h"
#endif
#ifndef CommandLink_h
#include "CommandLink.h"
#endif
template < class Protocol >
class Commander
{
typedef CommandLink< Protocol > LinkType;
private:
ContextMaintainer oldContext;
public:
Commander()
: oldContext( *LinkType::ActiveHandler() )
{
Assert( LinkType::ActiveHandler() != 0 );
}
Protocol& operator*() { Assert( !Null() ); return *LinkType::ActiveHandler(); }
Protocol *operator->() { Assert( !Null() ); return LinkType::ActiveHandler(); }
const Protocol& operator*() const { Assert( !Null() ); return *LinkType::ActiveHandler(); }
const Protocol *operator->() const { Assert( !Null() ); return LinkType::ActiveHandler(); }
static bool Null() { return LinkType::ActiveHandler() == 0; }
};
#endif